//
// Created by wze-zero on 2024/9/15 015.
//
#include <iostream>

using namespace std;

int main() {
    int num;
    while (cin >> num) {
        for (int i = 0; i < num; ++i) {
            if (i == 0 || i == num - 1) {
                for (int j = 0; j < num; ++j) {
                    cout << "* ";
                }
                cout << endl;
            } else {
                cout << "*";
                for (int j = 1; j < num - 1; ++j) {
                    cout << "  ";
                }
                cout << " *" << endl;
            }
        }
    }
    return 0;
}